#include "user.h"

UserSession& UserSession::getInstance()
{
    static UserSession instance;
    return instance;
}

void UserSession::loginUser(const QString &username, const QString& userType)
{
    setCurrentUsername(username);
    setCurrentUserType(userType);
    loggedIn = true;
    qDebug() << "User logged in:" << username;
}

void UserSession::logoutUser()
{
    currentUser = {"", ""};
    loggedIn = false;
    qDebug() << "User logged out.";
}

bool UserSession::isLoggedIn() const { return loggedIn; }

QString UserSession::getCurrentUsername() const { return currentUser.username; }

QString UserSession::getCurrentUserType() const { return currentUser.userType; }

void UserSession::setCurrentUsername(const QString& username) { currentUser.username = username; }

void UserSession::setCurrentUserType(const QString& userType) { currentUser.userType = userType; }

UserSession::UserSession() : loggedIn(false) {}



